local weilun = fk.CreateSkill {
  name = "fk__weilun",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["fk__weilun"] = "伪论",
  [":fk__weilun"] = "锁定技，当有牌移入游戏后，你摸一张牌并令武将牌上第X个技能本回合失效（X为你本回合此技能已发动的次数）。",
  ["@fk__weilun-turn"] = "伪论",

  ["$fk__weilun1"] = "康成公之注，发明大义而已。",
  ["$fk__weilun2"] = "诸子聚讼莫决者，必以圣言为定论。",
}

weilun:addEffect(fk.AfterCardsMove, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(weilun.name) then
      for _, move in ipairs(data) do
        if move.toArea ~= Card.Void then
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.PlayerSpecial then
              return true
            end
          end
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local x = player:usedSkillTimes(weilun.name, Player.HistoryTurn)
    room:setPlayerMark(player, "@fk__weilun-turn", x)
    local skills = Fk.generals[player.general]:getSkillNameList(true)
    if player.deputyGeneral ~= "" then
      table.insertTable(skills, Fk.generals[player.deputyGeneral]:getSkillNameList(true))
    end
    local skill = skills[x]
    if skill then
      room:addTableMark(player, "fk__weilun_skill-turn", skill)
    end
    player:drawCards(1, weilun.name)
  end,
})

weilun:addEffect('invalidity', {
  invalidity_func = function(self, player, skill)
    return table.contains(player:getTableMark("fk__weilun_skill-turn"), skill.name)
  end
})

return weilun
